import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import {resolve} from 'path'

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [vue()],
  resolve: {
    alias: {
      '@': resolve(__dirname, 'src')
    }
  },
  server: {
    host: '0.0.0.0',
    port: 3000,
    proxy: {
    '/api/sys':{
      target:'http://localhost:6001',
      changeOrigin:true,
      rewrite:path=>path.replace(/^\/api\/sys/,''),
      secure:false
    },
    '/api/user':{
      target:'http://localhost:6002',
      changeOrigin:true,
      rewrite:path=>path.replace(/^\/api\/user/,''),
      secure:false
    },
    '/api/order':{
      target:'http://localhost:6009',
      changeOrigin:true,
      rewrite:path=>path.replace(/^\/api\/order/,''),
      secure:false
    }
    }
  },
  build: {
    outDir: 'dist',
    assetsDir: 'assets'
  },
  optimizeDeps: {
    include: ['element-plus', 'element-plus/es', 'element-plus/es/components/message/style/css']
  }
})